Release 10.1A: OpenEdge Development:
Programming Interfaces
The CONNECT statement
The
CONNECTstatement allows you to connect to a database from a Progress procedure or directly from the Progress Procedure Editor. TheCONNECTstatement has the following syntax:
physical-nameAn argument that represents the actual name of the database on a disk. The first
physical–nameargument you specify in aCONNECTstatement does not require the Database Name (–db) parameter. All subsequentphysical–namesmust be preceded by the –db parameter.parameter-fileThe name of a parameter file that contains database connection information. See the OpenEdge Deployment: Startup Command and Parameter Reference for more information on parameter files.
parametersOne or more database connection parameters. Each connection parameter applies to the most recently specified database (–db). For the parameters you can specify, see the information on client connection parameters in the OpenEdge Deployment: Startup Command and Parameter Reference .
NO-ERRORThis argument suppresses the error condition, but still displays the error message when an attempt to
CONNECTto a database fails.Although you can connect to several databases within one
CONNECTstatement, it is a good idea to connect only one database perCONNECTstatement, because a connection failure for one database causes a termination of the currentCONNECTstatement. However, databases already connected when the statement terminates stay connected. In cases like this, it is a good idea to use theCONNECTEDfunctions to see which databases were connected and which were not.Here is an example of using a parameter file with the
CONNECTstatement:
In this example, the
CONNECTstatement uses theparm3.pffile to connect to the appldb1 database.
A single procedure cannot connect to and then access a database. The following code fragment does not run:
By splitting this example into a procedure and a subprocedure, you can connect to the database in the main procedure, and then access it in the subprocedure:
For more information on the
CONNECTstatement, see the OpenEdge Development: Progress 4GL Reference .
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |